import time
import unittest

import config
import utils
from base.get_driver import Get_Driver
from page.page_cart import Page_Cart
from page.page_login import Page_Login

log = utils.Logger(config.base_dir + '/log/all.log', level='info')
class Test_Cart(unittest.TestCase):
    def setUp(self):
        self.driver = Get_Driver().get_driver()
        self.login = Page_Login(self.driver)
        # 点击登录
        self.login.page_login_button()
        self.login.page_login("13012345678", "123456", "8888")
        self.cart = Page_Cart(self.driver)

    def test_cart(self):
        self.cart.page_insert_goods()
        msg = self.cart.page_cart_frame()
        log.logger.info("获取的文本信息为: {}".format(msg))
        self.assertEqual(msg, "添加成功")
        self.cart.page_cart_close_win()

    def tearDown(self):
        Get_Driver().quit_driver()
